home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 12644 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.6 KB  |  48 lines

  1. Newsgroups: comp.lang.c++
  2. Path: nntp.coast.net!torn!news!apollo!saed
  3. From: saed@engn.uwindsor.ca (Saed Aryan,13325,1100,g)
  4. Subject: Dynamic Linking with g++ on SUN
  5. X-Nntp-Posting-Host: apollo.engn.uwindsor.ca
  6. Message-ID: <DoLAuo.D44@news.uwindsor.ca>
  7. Keywords: dynamic linking, g++, sun
  8. Sender: news@news.uwindsor.ca (Usenet)
  9. Reply-To: saed@engn.uwindsor.ca
  10. Organization: VLSI Research Group - University of Windsor
  11. Date: Wed, 20 Mar 1996 23:35:12 GMT
  12.  
  13. Hi All,
  14.  
  15. ---How do I tell the g++ linker that my libraries are shared objects?
  16.  
  17.  
  18. 1. I compile the library files as follows: g++ -c mylib.C
  19. 2. Then I want to create the shared object by: g++ -G -o libmylib.so mylib.o
  20.    But -G is not supported by g++ anymore,
  21.    it must be -shared so: g++ -shared -o libmylib.so mylib.o
  22. 3. But now when compiling a C++ program 'useMylib.C' and including the library
  23.    as in: g++ -L. useMylib.C -lmylib 
  24.    I get an error: ld: -lmylib: No such file or directory
  25. 4. And when I rename libmylib.so to libmylib.a (which doesn't make sense but I
  26.    had to do something) I get the error:
  27.    collect2: dynamic dependency libmylib.so.0.0 not found
  28.  
  29. I would appreciate it if someone could give me the correct recipe for compiling
  30. an s.o. library, and including it when compiling the actual C++ program.
  31.  
  32. I am using GNU C++ g++ 2.7.0  on SUN OS 4.1.3
  33.  
  34. The GNU C++ FAQ doesnt' help me, neither does the man page. I am also looking for
  35. those famous 'manuals in the distribution' but can't find them. A related question
  36. about the manual has been posted to the gnu g++ newsgroup.
  37.  
  38. Thanks a lot in advance,
  39.  
  40. Aryan.
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.